package com.yidiandao.business.ui.main.shoppingcart.inventory;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.ConfirmOrderModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 确认订单-商品列表-Activity.
 */
public class InventoryActivity extends BaseActivity {

    private InventoryFragment mInventoryFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, InventoryActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mInventoryFragment = (InventoryFragment) getSupportFragmentManager().findFragmentById(R.id.container_inventory);

        if (mInventoryFragment == null) {
            mInventoryFragment = InventoryFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mInventoryFragment, R.id.container_inventory);
        }
    }

    @Override
    protected void initPresenter() {
        new InventoryPresenter(mInventoryFragment, new ConfirmOrderModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_inventory;
    }
}
